// pages/my/addGoods/addGoods.js
var app = getApp()
Page({
  data: {
    showSearchImg: true,
    selectIndex: 1,
    selectIndex: 0,
    types: [{
      name: "充电器",
      categoryId: 0,
      type: 0
    }, {
      name: "控制器",
      categoryId: 0,
      type: 0
    }, {
      name: "音响改装",
      categoryId: 0,
      type: 0
    }, {
      name: "前后减震",
      categoryId: 0,
      type: 1
    }, {
      name: "仪表",
      categoryId: 0,
      type: 1
    }, {
      name: "其他",
      categoryId: 0,
      type: 1
    }],
    goodsList: [{
        name: '电瓶车电动车控制器新日爱玛雅迪小刀台铃',
        url: '../../../image/default_headimg.png',
        stock: '123',
        add:true

      },
      {
        name: '电瓶车电动车控制器新日爱玛雅迪小刀台铃',
        url: '../../../image/default_headimg.png',
        stock: '1',
        add:false

      },
    ]
  },

  onLoad: function(options) {
    app.getMemInfo().then(res=>{
      console.log(res.data.agentId)
      this.setData({
        agentId:res.data.agentId
      })
      let data = {
        agentId:res.data.agentId,
        orderState:'4',
        storeState:0
      }
      console.log(data)
      app.request('wx_app/agent_order/getStoredOrderList',data,'GET').then(res=>{
        console.log(res)
      })
    })
  },
  searchFocus: function() {

    this.setData({
      showSearchImg: false
    })
  },
  showGoodsList:function(){
    wx.navigateTo({
      url: '../searchGoods/searchGoods',
    })
  },
  addCustomGoodsTap:function(){
    wx.navigateTo({
      url: '../addCustomGoods/addCustomGoods',
    })
  },

  selecttypeTap: function (event) {
    var dataSet = event.currentTarget.dataset;
    var selectIndex = dataSet.index;
    var categoryId = dataSet.categoryId;//查询不同分类下的数据
    this.setData({
      selectIndex: selectIndex
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})